package com.example.stumanager.config;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;

import com.example.stumanager.HomepageLoginInterface;
import com.example.stumanager.R;
import com.example.stumanager.database.UserSql;
import com.example.stumanager.entity.UserEntity;

/**
 * 个人信息
 * 管理员和学生通用
 */
public class PersonalInformation extends AppCompatActivity {
    Button re;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.personal_information);
        UserSql db=new UserSql(this);
        UserEntity u=db.getById(HomepageLoginInterface.stuId);
        TextView info=findViewById(R.id.info);
        if(u==null){
            info.setText("无");
        }else{
            String str="学号："+u.getNumber()+"\n";
            str+="姓名："+u.getName()+"\n";
            str+="密码："+u.getPassWord()+"\n";
            str+="宿舍："+u.getDormitory()+"\n";
            str+="班级："+u.getGrade() ;
            info.setText(str);
        }
        re = findViewById(R.id.re);
        re.setOnClickListener(view -> finish());
    }
}